﻿using EkStudio.com.bean.xml.reflection;
using EkStudio.com.bean.xml.RootInterface;
using EkStudio.com.bean.xml.RootInterface.DataSource;
using EkStudio.com.bean.xml.RootInterface.language;
using EkStudio.com.bean.xml.RootInterface.Plugin;
using EkStudio.com.common.unit;
using System;
using EkStudio.com.bean.xml.BillModule;
using EkStudio.com.bean.xml.RootInterface.FieldEvent;

namespace EkStudio.com.bean.xml.BillMapping
{
    /// <summary>
    /// 库存数据映射配置
    /// </summary>
    [XmlRootElement("root")]
    public class BillDataMapItem : BillFormatModule
    {
        private log4net.ILog logger = log4net.LogManager.GetLogger(typeof(BillDataMapItem));

        private bool readOnly = false;

        private BillDataMapRoot mapProperties = null;//主要数据属性

        private BillDataMapGroupRoot groupProperties = null;//出入模块配置

        private BillExpandJavaCodeRoot expandProperties;//java扩展代码

        private BillFieldsI18nRoot i18nProperties = null;//多语言

        [XmlElement]
        public BillDataMapRoot MapProperties
        {
            get { return mapProperties; }
            set { mapProperties = value; }
        }
        [XmlElement]
        public BillDataMapGroupRoot GroupProperties
        {
            get { return groupProperties; }
            set { groupProperties = value; }
        }

        [XmlElement]
        public BillExpandJavaCodeRoot ExpandProperties
        {
            get { return expandProperties; }
            set { expandProperties = value; }
        }

        [XmlElement]
        public BillFieldsI18nRoot I18nProperties
        {
            get { return i18nProperties; }
            set { i18nProperties = value; }
        }
        [XmlTransient]
        public BillSourceRoot DataSource
        {
            get { return null; }
            set { }
        }
        [XmlTransient]
        public object ParentBean
        {
            get { return null; }
            set { }
        }
        [XmlTransient]
        public BillUiGroupRoot UiField
        {
            get
            {
                return null;
            }

            set
            {
                
            }
        }
        [XmlTransient]
        public BillDataFillRoot DataFill
        {
            get{ return null;  }

            set { }
        }

        /// <summary>
        /// 单据配置Key
        /// </summary>
        /// <returns></returns>
        public string getKey()
        {
            return mapProperties.Key;
        }

        public string getCaption()
        {
            return mapProperties.Caption;
        }

        public void setReadOnly(bool read)
        {
            readOnly = read;
        }

        public bool isReadOnly()
        {
            return readOnly;
        }

        public int getBillType()
        {
            return ProjectUtil.TYPE_BILL_DATAMAP;
        }

        public string getJavaPackage()
        {
            return mapProperties.JavaPackage;  
        }

        public string getLanguageText()
        {
            return mapProperties.LanguageTexts;
        }

        public string getVersion()
        {
            return mapProperties.RootVersion;
        }

        public object Clone()
        {
            throw new NotImplementedException();
        }
    }
}
